package com.css.zfzx.data.primary.yhDisasterPG.controller;

import com.css.zfzx.data.primary.yhDisasterPG.service.YhDisasterPGService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lxg
 * @date 2020-11-10
 */
@Slf4j
@RestController
@RequestMapping("/data/yh/yhDisasterPG")
public class YhDisasterPGController {
    @Qualifier("yhDisasterFwPGServiceImpl")
    @Autowired
    private YhDisasterPGService fwService;
    @Qualifier("yhDisasterSzPGServiceImpl")
    @Autowired
    private YhDisasterPGService szService;
    @Qualifier("yhDisasterCsPGServiceImpl")
    @Autowired
    private YhDisasterPGService csService;


    /**
     * 迁移新建的数据不包含修改的
     */
    @Scheduled(cron = "${schedule.cron}")
    @GetMapping("/getData")
    public void newData(){
        //fwService.findDataCreate();
        System.out.println("yh_disaster_fw开始解析createTime！");
        fwService.findDataCreate1();

        System.out.println("yh_disaster_sz开始解析createTime！");
        szService.findDataCreate();

        System.out.println("yh_disaster_cs开始解析createTime！");
        csService.findDataCreate();
    }

    /**
     * 迁移修改的数据包含删除的
     */
    @Scheduled(cron = "${schedule.cron}")
    @GetMapping("/getUpdateData")
    public void updateData(){
        //fwService.findDataUpdate();
        System.out.println("yh_disaster_fw开始解析updateTime！");
        fwService.findDataUpdate1();

        System.out.println("yh_disaster_sz开始解析updateTime！");
        szService.findDataUpdate();

        System.out.println("yh_disaster_cs开始解析updateTime！");
        csService.findDataUpdate();
    }

}